package com.franklin.validation.core.support;

import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.context.ResourceLoaderAware;
import org.springframework.context.annotation.ImportBeanDefinitionRegistrar;
import org.springframework.core.io.ResourceLoader;
import org.springframework.core.type.AnnotationMetadata;

/**
 * Description :
 * Create By: Franklin
 * Date : 2020/6/11 15:38
 */
public class JsonComponentPackageScan implements ImportBeanDefinitionRegistrar, ResourceLoaderAware {

    private final static String PATH = "com.franklin.validation.core";

    private ResourceLoader resourceLoader;

    @Override
    public void setResourceLoader(ResourceLoader resourceLoader) {
        this.resourceLoader = resourceLoader;
    }

    @Override
    public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) {
        JsonComponentPackageScanHandle scanHandle = new JsonComponentPackageScanHandle(registry, false);
        scanHandle.doScan(PATH);
    }
}
